package com.jzlin.funhub.admin.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 文章状态.
 *
 * @author linjz
 * @since 2025/7/15
 */
@Getter
@AllArgsConstructor
public enum ArticleStatusEnum {
    DRAFT(1, "草稿"),
    PUBLISHED(2, "已发布"),
    DELETED(3, "已删除");

    private final int code;
    private final String desc;

    public ArticleStatusEnum ofCode(int code) {
        for (ArticleStatusEnum e : values()) {
            if (e.code == code) {
                return e;
            }
        }
        return null;
    }
}
